package 笔试.笔试360;

import java.util.LinkedList;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        int M=sc.nextInt();
        int[] operation=new int[M];
        for (int i = 0; i < M; i++)
        {
            operation[i]=sc.nextInt();
        }
        LinkedList<Integer> list = new LinkedList<>();
        for (int i = 1; i <= N; i++)
        {
            list.add(i);
        }
        int num=0;
        for (int i = 0; i < operation.length; i++)
        {
            if (operation[i]==1)
            {
                if (num>0)
                {
                    if (num%2==2)
                        continue;
                    else
                        method2(list);

                    num=0;
                }
                method1(list);
            }
            else if (operation[i]==2)
            {
                num++;
            }


        }
        for (int i = 0; i < list.size(); i++)
        {
            System.out.print(list.get(i)+" ");
        }

    }
    public static void method1(LinkedList<Integer> list)
    {
        Integer first = list.pollFirst();
        list.addLast(first);
    }
    public static void method2(LinkedList<Integer> list)
    {
        for (int i = 0; i < list.size(); i+=2)
        {
            Integer num1 = list.get(i);
            Integer num2 = list.get(i + 1);
            list.set(i,num2);
            list.set(i+1,num1);
        }
    }

}
